home *** CD-ROM | disk | FTP | other *** search
- /***
- * main.c
- *
- * Tester routine for the URLHelper component. This routine will try to exercise all the
- * various facets of the component.
- *
- ***/
- #include "debug_me.h"
- #include <stdio.h>
- #include "URLHLibrary.h"
-
- char *StrPrint (StringPtr string);
- void Lib1Sub (StringPtr string);
- void LibAllSub (StringPtr string);
-
- /**
- ** Global stuff we need if we are debugging -- this is because we have to supply
- ** all the info about the component when we register.
- **/
-
- void main () {
-
- Lib1Sub("\pftp://sumex-aim.stanford.edu/info-mac/grf/util/mac-graphics.hqx");
- Lib1Sub("\pgopher://sumex-aim.stanford.edu/info-mac/per/im/infomacv12-044.txt");
- Lib1Sub("\pgopher://mac.archive.umich.edu/pub/system/updates/long/dir/help.txt");
- LibAllSub("\pftp://sumex-aim.stanford.edu/info-mac/grf/util/mac-graphics.hqx");
- LibAllSub("\pgopher://sumex-aim.stanford.edu/info-mac/per/im/infomacv12-044.txt");
- LibAllSub("\pgopher://mac.archive.umich.edu/pub/system/updates/long/dir/help.txt");
-
- return;
- }
-
- /**
- * StrPrint
- *
- * Dump a string to printf...
- *
- **/
- char * StrPrint (StringPtr str)
- {
-
- static char string[256];
-
- BlockMove (str+1, string, str[0]);
- string[str[0]] = '\0';
- return string;
- }
-
- /**
- * Lib1Sub
- *
- * Use the library to get the primary miirror back
- **/
- void Lib1Sub (StringPtr string)
- {
- Str255 mirror;
-
- printf ("Getting primary mirror for '%s'\n", StrPrint(string));
- URLHLibGetFirstMirror (string, mirror);
- printf ("And it is: '%s'\n", StrPrint(mirror));
- }
-
- void LibAllSub (StringPtr string)
- {
- short index;
- URLHParseRef parseRef;
- Str255 mirror;
-
- printf ("Getting all mirrors for '%s'\n", StrPrint(string));
- parseRef = URLHLibNewParseState (string);
- index = 1;
- while (URLHLibGetIndexedMirror (parseRef, index, mirror)) {
- printf ("-> '%s'\n", StrPrint(mirror));
- index++;
- }
- URLHLibDisposeParseState (parseRef);
- }
-